﻿using System;
using System.Net;
using System.Net.Sockets;
using BuzzX8.Xmpp.Connectivity;

namespace BuzzX8.Xmpp.Server
{
    public class XmppListener
    {
        private TcpListener tcpListener;

        public XmppListener()
        {
            tcpListener = new TcpListener(IPAddress.Any, ConnectionSettings.DefaultClientPort);
        }

        public IXmppChannel AcceptChannel()
        {
            Socket socket = tcpListener.AcceptSocket();
            NetworkChannel channel = new NetworkChannel(socket);
            return channel;
        }

        public void Start()
        {
            tcpListener.Start();
        }

        public void Stop()
        {
            tcpListener.Stop();
        }
    }
}
